/**
 * @Author MrLi
 * @Version 1.0
 * @Date 2023-08-11 17:18:25
 */
package com.cl.erp_2301.controller;

import com.cl.erp_2301.Service.ViewStorealertService;
import com.cl.erp_2301.dto.DataDTO;
import com.cl.erp_2301.dto.ViewDTO;
import com.cl.erp_2301.util.Result;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/v2")
public class ViewStorealertController {


    @Resource
    private ViewStorealertService viewStorealertService;
    /*/storealert*/
    @RequestMapping(value = "/storealert", method = RequestMethod.GET)
    public Result findAll(int page, int rows, HttpSession session){
        Page<Object> page1 = PageHelper.startPage(page,rows);
        List<ViewDTO> storeDtoList  = viewStorealertService.findAll();
        DataDTO data1 = new DataDTO();
        data1.setRows(storeDtoList);
        data1.setTotal(page1.getTotal());
        return Result.ok(data1);
    }

}
